Many electronic devices utilize a local layout generator that determines the layout for an electronic document before rendering the document on the device display screen. The layout generator optimizes the layout based on the type of the document and the size and orientation of the device display screen. For instance, a news feed displays a summary page that may include excerpts of several articles. When a user selects one of the articles, a local layout generator on the device determines a layout for rendering the article and optimizes the layout based on different criteria.
For an article that includes many components such as text, image, video, etc., there may be a delay between the selection of the article from the summary page and rendering of the article on the device display due to the time required to determine a layout for the article. It is also desirable to determine a location on the layout for including an advertisement. In addition, an article may include a web object such as a Twitter card or a Facebook post. These web objects have to be retrieved from different content servers than the content server of the article publisher. The layout has to be determined based on the height of these web objects.